package practice09;


import java.util.ArrayList;
import java.util.List;

public class Klass {
    private int number;
    private Student leader;

//    List<String> list=new ArrayList();

    public String assignLeader(Student student) {
//        boolean b=false;
//        for (String s: list){
//            if (s==student.getName()){
//                b=true;
//            }
//        }
//        if (b==true){
////            appendMember(student);
//            leader = student;
//            return leader.introduce();
//        }else {
//            System.out.println("It is not one of us.");
//            return null;
//        }
        if (student.getKlass().equals(this)) {
            this.leader = student;
            return leader.introduce();
        } else {
            System.out.println("It is not one of us.");
            return null;
        }
    }

    public void appendMember(Student student){
//        if (student.getKlass().getNumber()==number){
//            list.add(student.getName());
//
//        }
        student.setKlass(this);

//        if (student.getKlass().getNumber()!=number){
//            System.out.println("It is not one of us.");
//        }else {
//            System.out.println("It is not one of us.");
//        }

    }

    public String getDisplayName() {
        return "Class " + number;
    }

    public Student getLeader() {
        return leader;
    }

    public void setLeader(Student leader) {
        this.leader = leader;
    }

    public Klass(int number) {
        this.number = number;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }
}
